package com.yy.job.core.domain.converter;

import com.yy.job.common.dao.po.YYJobDO;
import com.yy.job.core.domain.JobDomain;

public class JobDomainConverter {

	public static YYJobDO convertToDO(JobDomain jobDomain) {
		if (jobDomain == null) {
			return null;
		}

		YYJobDO jobDO = new YYJobDO();
		jobDO.setId(jobDomain.getId());
		jobDO.setProjectCode(jobDomain.getProjectCode());
		jobDO.setModuleCode(jobDomain.getModuleCode());
		jobDO.setModuleName(jobDomain.getModuleName());
		jobDO.setJobCode(jobDomain.getJobCode());
		jobDO.setJobName(jobDomain.getJobName());
		if (jobDomain.getJobStatus() != null) {
			jobDO.setJobStatus(jobDomain.getJobStatus().getCode());
		}
		jobDO.setExecuteType(jobDomain.getJobExecuteType().getCode());
		jobDO.setBusinessNo(jobDomain.getBusinessNo());
		jobDO.setExecTime(jobDomain.getExecTime());
		jobDO.setExecCount(jobDomain.getExecCount());
		jobDO.setExpectedStartTime(jobDomain.getExpectedStartTime());
		jobDO.setVersion(jobDomain.getVersion());
		jobDO.setCreator(jobDomain.getOperator());
		jobDO.setModifier(jobDomain.getOperator());
		if (jobDomain.getIsDeleted() != null) {
			jobDO.setIsDeleted(jobDomain.getIsDeleted().getCode());
		}
		return jobDO;
	}

}
